package interface_;

public class Test02 {
    public static void main(String[] args) {
        new Device().work(new Computer());
        System.out.println("=========");
        new Device().work(new Camera());
    }
}
interface UsbInterface {
    void start();
    void stop();
}
class Device {
    void work(UsbInterface usbInterface) {
        usbInterface.start();
        usbInterface.stop();
    }
}
class Computer implements UsbInterface{

    @Override
    public void start() {
        System.out.println("电脑开始工作");
    }

    @Override
    public void stop() {
        System.out.println("电脑停止工作");
    }
}
class Camera implements UsbInterface{

    @Override
    public void start() {
        System.out.println("相机开始工作");
    }

    @Override
    public void stop() {
        System.out.println("相机停止工作");
    }
}
